# -*- coding: utf-8 -*-
from tool import json_post, host_db
from cfg import g_line


def tech_test(wsn, tech_count):
    sn = "te%s%s" % (wsn, tech_count)

    r = json_post(host_db("tech/add"), {
        "line": g_line,
        "k": sn,
        "v": {
            "name": "name_%s" % sn
            }
        })

    print(r)

    r = json_post(host_db("tech/get"), {
        "line": g_line,
        "k": sn,
        })

    print(r)

    r = json_post(host_db("tech/md"), {
        "line": g_line,
        "k": sn,
        "v": {
            "bom": False,
            }
        })

    print(r)

    r = json_post(host_db("tech/rm"), {
        "line": g_line,
        "k": sn,
        })

    print(r)

    r = json_post(host_db("tech/list"), {
        "line": g_line,
        })

    print(r)


if __name__ == "__main__":
    tech_test("op0", 0)
